package com.atguigu.gulimall.product.entity;

import com.atguigu.common.exception.group.AddGroup;
import com.atguigu.common.exception.group.UpdateGroup;
import com.atguigu.common.exception.group.UpdateStatus;
import com.atguigu.gulimall.product.myvalid.ListValue;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.URL;

import javax.annotation.Nonnull;
import javax.validation.constraints.*;

/**
 * 品牌
 * 
 * @author hxm
 * @email hxm@gmail.com
 * @date 2020-04-30 11:10:05
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	@Null(groups = AddGroup.class)
	@NotNull(message = "修改是id不能为空", groups = UpdateGroup.class)
	@TableId
	private Long brandId;
	/**
	 * 品牌名
	 */
	@NotBlank(message = "品牌名必须提交",groups = {UpdateGroup.class,AddGroup.class})
	private String name;
	/**
	 * 品牌logo地址
	 */
	@URL(message = "logo必须是一个合法的url地址",groups = {UpdateGroup.class,AddGroup.class})
	private String logo;
	/**
	 * 介绍
	 */
	private String descript;
	/**
	 * 显示状态[0-不显示；1-显示]
	 */
	@Nonnull
	@ListValue(vals = {0, 1},message = "showStatus只能是0或者1",groups = {UpdateGroup.class,AddGroup.class, UpdateStatus.class})
	public Integer showStatus;
	/**
	 * 检索首字母
	 */

	@Pattern(regexp = "^[a-zA-Z]$",message = "检索首字母有错误",groups = {UpdateGroup.class,AddGroup.class})
	private String firstLetter;
	/**
	 * 排序
	 */
	@NotNull
	@Min(value = 0,message = "最小值是0")
	private Integer sort;

}
